package com.ruoyi.fjtseac.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zzl
 * @date 2022/7/8 13:25
 */
//@Configuration
public class ResourceConfig implements WebMvcConfigurer {

    @Value("${path.directory.proxy}")
    private String proxyPath;

    @Value("${path.directory.real}")
    private String realPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler('/' +proxyPath + "/**") //指的是对外暴露的访问路径,使用该路径替代下面的内部文件放置的目录
                .addResourceLocations("file:"+ realPath+ "/");
    }
}
